package com.usian.article.controller;

import com.usian.apis.article.ApArticleContentControllerApi;
import com.usian.article.service.ApArticleContentService;
import com.usian.model.article.pojos.ApArticleContent;
import com.usian.model.common.dtos.ResponseResult;
import com.usian.model.common.enums.AppHttpCodeEnum;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/v1/article_content")
public class ApArticleContentController implements ApArticleContentControllerApi {


    @Autowired
    private ApArticleContentService apArticleContentService;

    @RequestMapping("/selectByArticleId/{articleId}")
    public ApArticleContent selectByArticleId(@PathVariable("articleId") Long articleId){
        return  apArticleContentService.selectByArticleId(articleId);
    }


    @PostMapping("/save")
    @Override
    public ResponseResult saveArticleContent(@RequestBody  ApArticleContent apArticleContent) {
        apArticleContentService.save(apArticleContent);
        return ResponseResult.okResult(AppHttpCodeEnum.SUCCESS);
    }
}
